%--------------------------------------------------------------------------
% computes and plots the diserpsion relation
%--------------------------------------------------------------------------

function [k, lambda] = lo_dispersion_relation(k, M, figs)

if nargin == 2
    figs = 1;
end

for i = 1:length(k)
    
    if (i == 1)
        tmp = lo_comp_eigs_adj(k(i), M);
    else
        tmp = lo_comp_eigs_adj(k(i), M, tmp);
    end
   
   lambda(i) = tmp(1);
    
end

if figs
    plot(k, lambda, 'k','linewidth',1);
    hold on;
    plot([k(1), k(end)], [0 0], 'k');
%     plot(k, (M/80 - 1) * k.^2, 'k--');
%     ylim([-2 1]);
    xlabel('$\check{k}$','interpreter','latex','fontsize',12);
    ylabel('$\check{\lambda}$','interpreter','latex','fontsize',12);
end